package de.hsma.srn.view.components;

import java.awt.Color;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import javax.swing.JList;
import javax.swing.JScrollPane;

public class ScrollPane extends JScrollPane {
	/**
	 * UID
	 */
	private static final long serialVersionUID = -9012080883477339290L;

	public ScrollPane() {
		super();
		initialize();
		initializeListeners();
	}
	public ScrollPane(JList list) {
		super(list);
		initialize();
		initializeListeners();
	}
	
	private void initialize() {
		this.setForeground(new Color(140, 180, 204));
		this.setBackground(new Color(255, 255, 255));
	}
	private void initializeListeners() {
		addFocusListener(new FocusListener() {

			@Override
			public void focusGained(FocusEvent arg0) {
				setForeground(new Color(0, 0, 0));
				setBackground(new Color(225, 235, 242));
			}

			@Override
			public void focusLost(FocusEvent arg0) {
				setForeground(new Color(140, 180, 204));
				setBackground(new Color(255, 255, 255));
			}
			
		});
	}
}
